export default{
	//时间转化
	dataTime(date){
		let oldTime = new Date(date);
		let currentTime = new Date();
		//获取旧时间的时间戳
		let t = oldTime.getTime();
		let h = oldTime.getHours();
		let min = oldTime.getMinutes();
		let y = oldTime.getFullYear();
		let mon = oldTime.getMonth();
		let d = oldTime.getDate(); 
		//获取现在时间的时间戳
		let ct = currentTime.getTime();
		let ch = currentTime.getHours();
		let cmin = currentTime.getMinutes();
		let cy = currentTime.getFullYear();
		let cmon = currentTime.getMonth();
		let cd = currentTime.getDate(); 
		//当天时间
		if(y == cy && mon == cmon && d == cd){
			if(h < 10){
				h = '0'+ h;
			}
			if(min<10){
				min = '0'+ min
			}
			return h +':'+ min;
		}
		//昨天时间
		if(d+1 == cd && mon == cmon && y == cy){
			if(h < 10){
				h = '0'+ h;
			}
			if(min<10){
				min = '0'+ min
			}
			return '昨天'+h+':'+min
		}else if(y == cy){
			if(h < 10){
				h = '0'+ h;
			}
			if(min<10){
				min = '0'+ min
			}
			//今年
			return mon+1+'月'+d+'日'+ h +':'+min
		}else{
			//大于今年
			if(h < 10){
				h = '0'+ h;
			}
			if(min<10){
				min = '0'+ min
			}
			return y+'年'+mon+'月'+d+'日'
		}
	},
	//间隔时间差
	spaceTime(oldTime,currentTime){
		oldTime = new Date(oldTime);
		currentTime = new Date(currentTime);
		var to = oldTime.getTime();
		var tc = currentTime.getTime();
		if(to > (tc+1000*60*5)){
			return currentTime;
		}else{
			return ''
		}
	}
}